package com.zengqingfa.designpattern.create.factory.simple;

public enum ProductEnum {

    ConcreteProduct1(1, "ConcreteProduct1"),

    ConcreteProduct2(2, "ConcreteProduct2");

    private Integer key;

    private String desc;

    ProductEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static boolean checkIn(Integer key) {
        if (key == null) {
            return false;
        }
        ProductEnum[] values = ProductEnum.values();
        for (int i = 0; i < values.length; i++) {
            if (values[i].key.equals(key)) {
                return true;
            }
        }
        return false;
    }
}
